﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="nhomtin.aspx.cs" Inherits="NCKH.Admin.nhomtin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
     <h2>QUẢN LÝ NHÓM TIN</h2>
    <table>
        <tr>
            <td>
                Tên nhóm tin
            </td>
            <td>
                <asp:TextBox ID="txttennhomtin" runat="server" Width="197px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="rfvktt" runat="server" ControlToValidate="txttennhomtin"
                        Display="Dynamic" ErrorMessage="thiếu tên nhóm tin">nhập tên nhóm tin</asp:RequiredFieldValidator>
                </td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:Button ID="btnthem" runat="server" OnClick="btnthem_Click" Text="Thêm mới" />
                <%--<asp:Button ID="tbnxoa" runat="server" OnClick="tbnxoa_Click" Text="Xóa" Width="63px" />--%>
                <asp:Button ID="btnhuy" runat="server" OnClick="btnhuy_Click" Text="Hủy" Width="57px" />
                </td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td>
                <asp:TextBox ID="txttimkiem" runat="server" Font-Italic="true" Width="202px"  CausesValidation="false"></asp:TextBox>
            </td>
            <td>
                <asp:Button ID="btntimkiem" runat="server" Text="Tìm kiếm" OnClick="btntimkiem_Click" Width="88px" />
            </td>
        </tr>

    </table>
    <asp:Label ID="lbtb" runat="server"></asp:Label>
    <asp:GridView ID="grvnhomtin" runat="server" AutoGenerateColumns="false" OnDataBound="grvnhomtin_DataBound" AllowPaging="true" 
            AllowSorting="true" Width="698px" OnRowCommand="grvnhomtin_RowCommand" OnPageIndexChanging="grvnhomtin_PageIndexChanging"
         DataKeyNames="Manhomtin" OnSorting="grvnhomtin_Sorting">
        <Columns>
            <asp:TemplateField HeaderText="STT">
               <ItemTemplate>
                    <%# Container.DataItemIndex + 1 %>
                 </ItemTemplate>
            </asp:TemplateField>
          <%-- <asp:TemplateField HeaderText="Chọn">
                <ItemTemplate>
                  <asp:CheckBox ID="chkxoa" runat="server" />
                </ItemTemplate>
            </asp:TemplateField>--%>
            <asp:TemplateField HeaderText="xóa">
                <ItemTemplate>
                    <asp:LinkButton ID="lbtxoa" runat="server" CommandArgument='<%# Eval("Manhomtin") %>' 
                        CommandName="xoa" Text="xóa" CausesValidation="false" >
                        <%--OnClientClick='return confirm("bạn có chắc chắn muốn xóa không?")'--%>
                    </asp:LinkButton>                   
                </ItemTemplate>
            </asp:TemplateField>
           <asp:BoundField Visible="false" DataField="Manhomtin" HeaderText="Mã nhóm tin" 
           InsertVisible="False" ReadOnly="True" SortExpression="Manhomtin" />
             <asp:TemplateField HeaderText="Mã nhóm tin" >
                <ItemTemplate>
                    <asp:Label ID="lblmanhomtin" runat="server" Text='<%# Eval("Manhomtin") %>'></asp:Label>
                </ItemTemplate>
              <ItemTemplate>
                    <asp:Label ID="lblmanhomtin" runat="server" Text='<%# Bind("Manhomtin") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tên nhóm tin" > <%--SortExpression="Tennhomtin"--%>
                <ItemTemplate>
                    <asp:Label ID="lbltennhomtin" runat="server" Text='<%# Eval("Tennhomtin") %>'></asp:Label>
                </ItemTemplate>
                
            </asp:TemplateField>
          <asp:TemplateField HeaderText="Sửa">
               <EditItemTemplate>
                    <asp:Button ID="btlCapnhat" CausesValidation="false" runat="server"
                             CommandName="Update" Text="Cập nhật" />
                    <asp:Button ID="btlhuy" CausesValidation="false" runat="server"
                             CommandName="Cancel" Text="hủy bỏ" />
                </EditItemTemplate>
                <ItemTemplate>
                    <a href='suanhomtin.aspx?pid=<%# Eval("Manhomtin") %>'>
                        <img src="images/edit.png" alt="Sửa" title="Sửa" /></a>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>
